/**
 * 业务相关复用逻辑
 */

import { ref, onMounted } from 'vue'
import { findBanner } from '@/api/home'

/**
 * @description 获取轮播图数据
 * @returns
 */
export const useBanner = () => {
  const slidersData = ref([])

  // 获取图片数据的方法
  const getSlidersData = async () => {
    const res = await findBanner()
    // console.log(res)
    slidersData.value = res.result
  }

  // 组件初始化时调用
  onMounted(() => {
    getSlidersData()
  })

  return { slidersData }
}
